using NHibernate;
using Spring.Data.NHibernate.Generic;
using Spring.Data.NHibernate.Generic.Support;

namespace Common.Dao
{
    /// <summary>
    /// Extended Hibernate Dao Support class
    /// </summary>
    public class HibernateDaoSupportEx : HibernateDaoSupport
    {
        /// <summary>
        /// Obtain the cached extended Hibernate template
        /// </summary>
        /// <returns>
        /// The created and cached extended template object
        /// </returns>
        public HibernateTemplateEx GetHibernateTemplateEx()
        {
            return (HibernateTemplateEx)this.HibernateTemplate;
        }

        /// <summary>
        /// Create an extended Hibernate template from session factory
        /// </summary>
        /// <param name="sessionFactory">
        /// The session factory object
        /// </param>
        /// <returns>
        /// The created object
        /// </returns>
        protected override HibernateTemplate CreateHibernateTemplate(ISessionFactory sessionFactory)
        {
            return new HibernateTemplateEx(sessionFactory);
        }
    }
}